<!-- 替换模板base.html的标题 -->
{% extends "base.html" %}
{% block title %}{{ post.name }}{% endblock %}

<!-- 替换模板base.html的正文 -->
{% block body %}
    <h3>{{ post.title }}</h3>
    {{ post.publish_date }}:
    {{ post.text }}

    <div class="row">
        <div class="col-lg-6">
            <p>作者 <a
                    href="{{ url_for('blog.user', username=post.users.username) }}">{{ post.users.username }}</a>
                on {{ post.publish_date }}</p>
        </div>
        <div class="col-lg-12">
            <h3>评价:</h3>
            <!-- 设置表单 -->
            <form method="POST" action="{{ url_for('blog.post', post_id=post.id) }}">
                {{ form.hidden_tag() }}
                <div>
                    <!-- Field: `name` label -->
                    {{ form.name.label }}
                    {% if form.name.errors %}
                        {% for e in form.name.errors %}
                            <p class="help-block">{{ e }}</p>
                        {% endfor %}
                    {% endif %}
                    {{ form.name(class_="form-control") }}
                </div>
                <div class="form-group">
                    {{ form.text.label }}
                    {% if form.text.errors %}
                        {% for e in form.text.errors %}
                            <p class="help-block">{{ e }}</p>
                        {% endfor %}
                    {% endif %}
                    {{ form.text(class_='form-control') }}
                </div>
                <input class="btn btn-primary" type="submit" value="新增评价">
            </form>
        </div>
        <div class="row">
            <div class="col-lg-2">
                <a href="{{ url_for('blog.edit_post', id=post.id) }}" class="btn btn-primary">Edit</a>
            </div>
        </div>
    </div>
{% endblock %}